<div id="view_black">	
	<div id="new_page">
		<div id ="new_page_border">
			<div id="new_page_header"><h1>Edit Page</h1></div>	
    
		    <div id="new_page_form">	
				<p><%= error_messages_for :page %></p>	
		
			
				
				<% form_for(:page, :url => page_path(@page), :html => { :method => :put }) do |f| %>
				<div id="edit_top">
					
					<div id="change_owner">
						<label for="name">Page Owner</label>
						<br/>
			  			<%= f.collection_select :user_id, User.editors, :id, :full_name %>
			  	</div>
					
					<div id="edit_graphic">
					  <% unless @page.graphic.nil? %>
						  <%= image_tag @page.graphic.public_filename(:thumb) %>
						  <ul>
			          <li><%= link_to "delete graphic", graphic_path(@page.graphic), :confirm => "Are you sure?", :method => :delete %></li>
						  </ul>
						  
						  <br/>
			      <% else %>
						
						<ul>
				     	<li><%= link_to "upload graphic", new_graphic_path(:page_id => @page) %></li>
						</ul>

				    <% end %>
					</div>
					
				</div>
				<div id="clear"></div>
				<p>
					<% unless @page.is_home? %>
					
    					<label for="name">Page Section</label>
						<br/>
    				   <%= f.collection_select :section_id, Section.main, :id, :name %>

  			    	<% end %>
				</p>
				<p>
	  				<label for="name">Page Title</label>
	  				<br/>
	  		    	<%= f.text_field :name, :class => :input_line %>
	  			</p>
				<p>
					  <label for="name">Page Headline</label>
					  <br/>
				    <%= f.text_field :headline, :class => :input_line %>
				</p>
			    <p>
			    	<label for="description">Body</label>
					  <br/>
				    <%= f.text_area :body %>
			    </p>
			    
				  <% unless Datasheet.find(:all).empty? %>
				    <div id="edit_datasheets">
  	  				<p>
  						  <ul>
  							  <li class="horizontal" id="upload_datasheet">
  							    <%= link_to "upload datasheet", new_datasheet_path(:page => @page) %>
  							  </li>
  	  					  <li class="horizontal">
  	  					    <label for="datasheets">Available Datasheets (check to attach)</label>
  	  					  </li>
  			  		  </ul>
						
  							<br/>
	  				
  	  					<% Datasheet.find(:all).each do |datasheet| %>
  	  						<div class="datasheet">
  	  							<%= check_box_tag "page[datasheet_ids][]", datasheet.id, @page.datasheets.include?(datasheet) %>
  	  							<%= link_to datasheet.name, datasheet.public_filename %>
  	  						</div>
  	  					<% end %>
  	  				</p>
	  				</div>
	  			<% end %>
	  			
				<br/>
  			<ul class="right">
  			  <% if @page.state == "draft" %>
  			    <li class="horizontal"><%= check_box_tag :review %>&nbsp;submit for review</li>
  		      <li class="horizontal">|</li>
  		    <% end %>
  		    
  		    <% if current_user.is_admin? %>
    		    <li class="horizontal"><%= link_to "delete", page_path(@page), :confirm => "Are you sure?", :method => :delete %></li>
  			    <li class="horizontal">|</li>
			    <% end %>
  		    
	  		  <li class="horizontal"><%= link_to "cancel", :controller => @page.section.name, :action => :show, :id => @page %></li>
			    <li class="horizontal">|</li>
				  <li class="horizontal"><%= submit_tag "save", 
		                                          :class => "btn", 
		                                          :onmouseover => "this.className='btn btnhov'", 
		                                          :onmouseout => "this.className='btn'" %></li>  		          
	  		</ul>
			
				<br/>
			  <% end %>
			</div>
		</div>
	</div>
</div>